# -*- coding: utf-8 -*-


from gevent import monkey;monkey.patch_all()
import gevent
import time


def task(i):
    time.sleep(1)
    print(f'任务{i}执行完毕')


def sync():
    for i in range(10):
        print(f'任务 {i} 执行中....')
        task(i)


def async_task():
    g_list = []
    for i in range(10):
        g = gevent.spawn(task, i)
        g_list.append(g)
    gevent.joinall(g_list)

# sync()
async_task()
